package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.BtyZxMdgz;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyZxMdgzParam;
import cn.stylefeng.guns.sys.modular.system.service.BtyZxMdgzService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;


/**
 * 控制器
 *
 * @author 
 * @Date 2021-09-08 14:10:32
 */
@Controller
@RequestMapping("/btyZxMdgz")
public class BtyZxMdgzController extends BaseController {

    private String PREFIX = "modular/system/btyZxMdgz";

    @Autowired
    private BtyZxMdgzService btyZxMdgzService;

    /**
     * 跳转到主页面
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyZxMdgz.html";
    }

    /**
     * 新增页面
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyZxMdgz_add.html";
    }

    /**
     * 编辑页面
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyZxMdgz_edit.html";
    }

    /**
     * 新增接口
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyZxMdgzParam btyZxMdgzParam) {
        this.btyZxMdgzService.add(btyZxMdgzParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyZxMdgzParam btyZxMdgzParam) {
        this.btyZxMdgzService.update(btyZxMdgzParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyZxMdgzParam btyZxMdgzParam) {
        this.btyZxMdgzService.delete(btyZxMdgzParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author 
     * @Date 2021-09-08
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyZxMdgzParam btyZxMdgzParam) {
        BtyZxMdgz detail = this.btyZxMdgzService.getById(btyZxMdgzParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author 
     * @Date 2021-09-08
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyZxMdgzParam btyZxMdgzParam) {
        return this.btyZxMdgzService.findPageBySpec(btyZxMdgzParam);
    }


    /**
     * 获取装修工资
     *
     * @author
     * @Date 2021-09-08
     */
    @ResponseBody
    @RequestMapping("/getGz")
    public ResponseData getGz(String timeLimit) {
        return this.btyZxMdgzService.getGz(timeLimit);
    }

    /**
     * 生成报销单
     *
     * @author
     */
    @RequestMapping("/addBxd")
    @ResponseBody
    public ResponseData addBxd(BtyZxMdgzParam param) {
        return btyZxMdgzService.addBxd(param);
    }

    /**
     * 撤回报销单
     *
     * @author
     */
    @RequestMapping("/rebutBxd")
    @ResponseBody
    public ResponseData rebutBxd(BtyZxMdgzParam param) {
        //status = 6才可删除
        return btyZxMdgzService.rebutBxd(param);
    }

    /**
     * 门店列表
     *
     * @author
     */
    @RequestMapping("/dmList")
    @ResponseBody
    public ResponseData dmList() {
        List<Map> list = this.btyZxMdgzService.dmList();
        return ResponseData.success(list);
    }
}


